<style>
.black_overlay{
  display: none;
  position: absolute;
  top: -42%;
  left: -50%;
  width: 200%;
  height: 100%;
  background-color: black;
  z-index:1001;
  -moz-opacity: 0.8;
  opacity:.80;
  filter: alpha(opacity=80);
}
#MyDiv,.white_content{
  display: none;
  height: 1300px;
    z-index: 1108;
     background-color: white; 
}
.white_content {
    display: block;
    position: absolute;
    top: 10%;
    left: 27%;
    width: 50%;
    height: 500px;
    background-color: white;
  
}
.ui.table{height: 100%}
.ui.popup{ width: 230px; }
</style>
<div class="cont">
  <div class="menus">

    <ng-include src="'views/comm/usertab.html'" class="ui row"></ng-include>
    <div class="menus_top" style="margin-top:60px">
      <div class="menus_l"><img alt="查看方式图标" src="dist/images/zt.png"/>查看方式</div>
      <ul id="nav" >
          <li id="all"><a title="8" ng-click="XuFeiList(9)">全部</a></li>
          <li class="selected"><a title="1" ng-click="XuFeiList(1)">新资源</a></li>
          <li><a title="2" ng-click="XuFeiList(2)">A类资源</a></li>
          <li><a title="3" ng-click="XuFeiList(3)">B类资源</a></li>
          <li><a title="4" ng-click="XuFeiList(4)">C类资源</a></li>
          <li><a title="5" ng-click="XuFeiList(5)">D类资源</a></li>
          <li><a title="6" ng-click="XuFeiList(6)">定金客户</a></li>
          <li><a title="7" ng-click="XuFeiList(7)">完款客户</a></li>
          <li><a title="8" ng-click="XuFeiList(8)">Z类客户</a></li>
      </ul>                  
    </div>
    <div class="menus_con" style="margin-top:60px;"> 
      <ul style="margin-top:10px;left:-20px">
        <li >
            <label for="textfield" class="li_lable">客户名/电话/微信ID</label>
            <input type="text"  ng-model="search_nickname" value=""  placeholder="客户名/电话/微信ID">
        </li>
        <li>
            <label for="textfield" class="li_lable" >标签</label>
            <input type="text" placeholder="标签" ng-model="search_tag_name" value="" >
        </li>  
        <li>
            <label for="textfield" class="li_lable">创建时间</label>
              <div class="ui left icon input" style="width:140px; height:34px;">
                <input name="create_time" id="create_time" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" placeholder="客户加入时间" value="">
                <i class="calendar icon"></i>
              </div>
        </li>  
        <li><a ng-click="XuFeiList()">查找</a></li>
      </ul>
    </div>
    <div class="menus_table" style="margin-top: 60px;">
      <table class="ui column table">
          <thead>
          <tr>
              <th>标识</th>
              <th>客户名</th>
              <th>服务人员</th>
              <th>归属地</th>
              <th>资金量(万)</th>
              <th>标签</th>
              <th>加入时间</th>
              <th>备注</th>
              <th>操作</th>
              <th>持股</th>
          </tr>
          </thead>
          <tbody id="y_xufei_list">
              <tr ng-repeat="list in Customer">
                  <td>
                    <div ng-switch="list.customer_flag">
                      <div ng-switch-when="1">
                         <img src="images/starsy.png" ng-click="Change_Star(list.customer_xufei_id)" id="star{{list.customer_xufei_id}}"> 
                      </div>
                      <div ng-switch-default>
                        <img src="images/starky.png" ng-click="Change_Star(list.customer_xufei_id)" id="star{{list.customer_xufei_id}}"> 
                      </div>
                    </div>
                  </td>
                  <td><a  href="/crm3/#/View360/{{list.customer_id}}">{{list.nickname}}</a></td>
                  <td>{{list.user_name}}</td>
                  <td>{{list.location}}</td>
                  <td>{{list.mount}}</td>   
                  <td ng-click="tab_select(list.customer_xufei_id,list.customer_id,list.user_id)" onclick="UpdateTag('MyDiv','fade')"> {{list.tags}}  </td>
                  <td>{{list.customer_create_time}}</td>
                  <td>{{list.note}}</td> 
                  <td ng-click="CustomerTypeShow(list.customer_xufei_id,list.customer_id,list.note)"><a>资料维护</a></td>
                  <td class="ui showdata" ng-mouseenter="hover_data(list.customer_xufei_id,$index)"  class="showstyle">
                      <div id="See{{$index}}"><a>查看推荐</a></div>
                     <!--  <div class="ui flowing popup top left transition hidden" style="top: auto; bottom: 64px; left: -100px; right: auto;"> -->
                     <div class="ui flowing popup top left transition hidden" style="width:240px;">
                        <div ng-switch="x.state" >
                          <div ng-switch-when="1">
                             <p>止盈</p>
                          </div>
                          <div ng-switch-when="-1">
                             <p>亏损</p>
                          </div>
                          <div ng-switch-default>
                             <p>持仓中</p>
                          </div>
                        </div>
                        <div class="ui button blue " style="float:right;margin-top:-28px;" ng-click="StockShow(list.customer_id,list.customer_xufei_id)"> + 推荐股票</div>
                        <div class="field"  ng-repeat="x in stock" style="clear:both">
                          <div ng-switch="x.state" >
                            <div ng-switch-when="1" style="color:red">
                              {{x.buy_time}}【{{x.stock_code}}】 {{x.stock_name}} {{x.profit}}% 
                            </div>
                            <div ng-switch-when="-1" style="color:green">
                                {{x.buy_time}}【{{x.stock_code}}】 {{x.stock_name}} {{x.profit}}%
                            </div>
                            <div ng-switch-default>
                                {{x.buy_time}}【{{x.stock_code}}】 {{x.stock_name}} {{x.profit}}%
                            </div>
                          </div>
                        </div>
                      </div>
                   
                  </td>   
              </tr>
          </tbody>
          <tbody id="w_xufei_list">
              <tr>
                  <td colspan="7" style="text-align: center; margin-top:10px;" class="null_data">没有找到数据~~~</td>
              </tr>  
          </tbody>
          <tfoot ng-if="XufeiPage.pageAll >1" id="w_xufei_lister">
              <tr>
                  <th colspan="7">
                      <div class="ui pagination menu" jspagination page-object="XufeiPage" page-func="XuFeiList" ></div>
                  </th>
              </tr>
          </tfoot>
      </table>
    </div>
  </div>
</div>

<!--弹出层时背景层DIV-->
<div id="fade" class="black_overlay">
</div>
 <!--弹框开始-->
 <div id = "MyDiv">
  <i class="close icon"></i>
  <div class="white_content">
    <div class="header_h4"> 编辑标签</div>
    <div class="content " ><!--表单-->
      <div class="form">
        <div class="inline fields" >
        
          <div class="fields" style="margin-top:20px;margin-left:140px;">
            <div class="another dropdown example" id="another">
              <div class="ui fluid multiple search selection dropdown" id="multiple_dropdown" style="width:420px;margin-left:100px">
                <input type="hidden" name="tag_select" id="tag_select" value="">
                <div class="default text" id="default_text">Select Tags</div>
                <input class="search" autocomplete="off" tabindex="0" ng-blur="Search_Tag()" ng-keyup="Search_Tag2()" style="float:right;">
                <div class="menu" tabindex="-1" id="menu_dropdown" style="height:150px;"></div>
              </div>
            </div>
          </div>
      </div>
    </div>
    <div class="actions " style="margin-top:220px;">
       <div class="center">
        <div class="ui pop_btn_qd" ng-click="Check_Tag()">{{'BTN_OK' | translate}}</div>
        <div class="ui pop_btn_qx" ng-click="close()"  >{{'BTN_CANCEL' | translate}}</div>
       </div>
    </div>
  </div>
</div>
 <!-- 表单开始 -->
<div class="ui CustomerTypeShow modal">
  <i class="close icon"></i>
  <div class="header_h4">
   资料维护
  </div>
  <div class="content">
   <div class=" form">
    <table class="ui sale_person table" style="height:400px;margin-bottom:20px">
      <tbody>
          <tr>
              <td >
                <input type="hidden" name="customer_xufei_id">
                <input type="hidden" name="customer_id">
                <div class="inline fields">
                  <div class="field">
                    <span style="margin-left:10px" >客户类型:</span>
                    <div class="ui selection dropdown" >
                      <input type="hidden" name="save_type" id="save_type"  value="">
                      <i class="dropdown icon"></i>
                      <div class=" text" id="default_type"></div>
                      <div class="menu">
                        <div class="item" ng-repeat="x in customer_type" id="type{{x.id}}" data-value="{{x.id}}">{{x.name}}</div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>
              <td>
                <div class="inline fields" >
                  <div class="field">
                    <span>资金量:</span>
                    <input type="text" name="customr_mount" id="customr_mount"  value="{{list_type.mount}}" style="height:32px;"> 万
                  </div>
                </div>
              </td>
              <td colspan="3"><button class="ui button" ng-click="ChangeCustomerType()">保存修改</button></td>
              <td></td>
          </tr>
          <tr>
            <td colspan="3"> 
              <div class="inline fields" >
                  <div class="field">
                    <span>备注:</span>
                    <input type="text" name="xcustomer_note" id="xcustomer_note"  value="{{list_type.note}}" placeholder="客户备注信息" style="height:32px; width:360px;">
                  </div>
              </div>
            </td>
          </tr>
          <tr>
            <td>
              <div class="inline fields">
                <div class="field">
                  <span>沟通记录:</span>
                  <input type="text" name="communication" id="communication"  value="" placeholder="沟通记录信息" style="height:32px;">
                </div>
              </div>
            </td>
           <td><button class="ui button " ng-click="AddCommunication()"><b>+</b> 添加沟通记录</button></td>
           <td colspan="4"></td>
          </tr>
          <tr>
            <td colspan="6">
             <table class="ui table" >
               <thead>
                <tr>
                  <th>沟通时间</th>
                  <th>沟通人</th>
                  <th>记录</th>
                  <th>通话时长(分)</th>
                  <th>录音</th>
                </tr>
              </thead>
              <tbody id="recordShow">
                <tr ng-repeat="x in customerLog">
                  <td>{{x.create_time}}</td>
                  <td>{{x.nickname}}</td>
                  <td>{{x.content}}</td>
                  <td>{{x.calltime}}</td>
                  <td>{{x.cdr_id}}</td>
                </tr>
                <tr ng-if="LogPage.pageNow >1">
                  <td colspan="6">
                    <div class="ui pagination menu" jspagination page-object="LogPage" page-func="CustomerTypeShow" ></div>
                  </td>
                </tr>
              </tbody>
              <tbody id="recordHide">
                <tr>
                  <td colspan="6" style="text-align:center;color:red">没有找到数据~~~</td>
                </tr>
              </tbody>
             </table>
            </td>
          </tr>
      </tbody> 
  </table>
  </div>
  </div>
</div>

<div class="ui addStock modal">
  <i class="close icon"></i>
  <div class="header_h4">
   添加推荐股票
  </div>
  <div class="content">
    <div class=" form">
      <form action="#" name="frm-addStock" id="frm-addStock" style="width:94%;margin-left:3%;">
         <div class="ui form">
          <div class="inline fields">
            <label>购买股票</label>
            <input type="hidden" id='addStock' name="addStock" value="">
            <input type="hidden" id='addStock_name' name="addStock_name" value="">
            <div class="field" id="check_ex1" > 
              <div angucomplete-alt id="_ex1"
                name="stock_ex1"
                placeholder="股票名称"
                maxlength="50"
                pause="100"
                selected-object="selectedStock"
                local-data="stock_list"
                search-fields="stock_name"
                title-field="stock_name"
                minlength="1"
                input-class="form-control form-control-small"
                match-class="highlight">
              </div>
            </div>
          </div>
          <div class="inline fields">
            <label>买入价格</label>
            <div class="field"> 
              <div class="ui left icon input">
                <input type="text" name="buy_price"/>
              </div>
            </div>
          </div>
          <div class="inline fields">
            <label>买入数量</label>
            <div class="field">
              <div class="ui left icon input">
                <input type="text" name="stock_count"/>
              </div>
            </div>
            <label>单位:手(1手=100股)</label>
          </div>
          <div class="field">
            <label>买入理由</label>
            <div class="ui left icon input">
              <textarea type="text" name="buy_reason"></textarea>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="actions" style="padding:14px;">
      <div class="center" style="margin-bottom:10px;">
        <div class="ui pop_btn_qd positive " >买入</div>
        <div class="ui pop_btn_qx negative">{{'BTN_CANCEL' | translate}}</div>
      </div>
    </div>
  </div>
<!-- 系统信息弹出层 is ending here-->
<div class="ui systemerror modal transition " >
  <div class="header ">系统提示</div>
  <div class="content ">
    <div class="inline fluid fields ">
      <div class="field " style="display: inline-block;width: 5%; " ng-show="productRcode==1 ">
        <i class="thumbs up large icon "></i>
      </div>
      <div class="field " style="display: inline-block;width: 5%; " ng-show="productRcode==0 ">
        <i class="thumbs down large icon "></i>
      </div>
      <div class="field " style="display: inline-block; ">
        <p>{{productMsg}}</p>
      </div>
    </div> 
  </div>
  <div class="actions ">
    <div class="ui positive button " ng-click="XuFeiList()">关闭</div>
  </div>
</div>

<script type="text/javascript">
  function AddTags(key,value){
      //删除默认数据
      $.ajax({
          type: "get",
          url: "/Admin/Xufei/DeleteDefaultTag",
          data: {tag_id:key,customer_id:value},
          dataType: "json",
              success: function (data) {
                $("#item"+data.tag_id).show();
                var tag_select = $("#tag_select").val();
                if(tag_select =="" || tag_select == undefined){
                  $("#default_text").text("Select Tags");
                }
              },
              error: function (msg) {
                  alert(msg);
              }
      });
  }
  function CheckTags(key){
    //样式检测
    $("#default_text").text("");
  }
  //弹出隐藏层
  function UpdateTag(show_div,bg_div){
    document.getElementById(show_div).style.display='block';
    document.getElementById(bg_div).style.display='block' ;
    var bgdiv = document.getElementById(bg_div);
    bgdiv.style.width = document.body.scrollWidth;
    // bgdiv.style.height = $(document).height();
    $("#"+bg_div).height($(document).height());
  };
  //关闭弹出层
  function CloseDiv(show_div,bg_div)
  {
    window.location.reload();
  };
</script>

<script type="text/javascript">
$( function(){
    $('.example .ui.dropdown')
      .dropdown({
        allowAdditions: true
    });
    $("#nav li").click(function(){
       $(this).addClass('selected').siblings().removeClass('selected');
    }); 
   
});
 /*买入推荐股票*/
  $('#frm-addStock').form({
      on: 'blur',
      inline : true,
      fields: {
           addStock: {
            identifier: 'addStock',
            rules: [
                {
                    type   : 'empty',
                    prompt : '买入价格不能为空'
                }
            ]},
          buy_price: {
            identifier: 'buy_price',
            rules: [
                {
                    type   : 'empty',
                    prompt : '买入价格不能为空'
                }
            ]},
          stock_count: {
            identifier: 'stock_count',
            rules: [
                {
                    type   : 'empty',
                    prompt : '买入数量不能为空'
                }
            ]}, 
          buy_reason: {
            identifier: 'buy_reason',
            rules: [
                {
                    type   : 'empty',
                    prompt : '买入原因不能为空'
                }
            ]}
      }});
</script>